<?php

namespace App\Repository;


use App\Models\UserAddress;

class UserAddressRepository
{
    public $userAddress;

    /**
     * UserAddressRepository constructor.
     * @param $userAddress
     */
    public function __construct(UserAddress $userAddress) 
    {
        $this->userAddress = $userAddress;
    }

    /**
     * 根据user_id获取用户的收货地址
     * @param $userId
     * @return \Illuminate\Database\Eloquent\Model|null|static
     */
    public static function getUserAddressByUserId($userId)
    {
        return UserAddress::where('user_id', $userId)->first();
    }
}